package test_activiti;

import java.util.HashMap;
import java.util.Map;

import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.activiti.engine.test.ActivitiTestCase;
import org.activiti.engine.test.Deployment;

public class 测试任务的重新提交  extends ActivitiTestCase {

	//可以用逗号分隔开要部署的bpmn
	@Deployment(resources = {"bgApp.bpmn"})
	public void testMe() {
		    ProcessInstance pi = runtimeService.startProcessInstanceByKey("bgApp");
		    String piId = pi.getId();

		    Task task = taskService.createTaskQuery().taskAssignee("yw").singleResult();
		    String task_yw_id=task.getId();

		    Map<String,Object> vmap = new HashMap<String,Object>();
		    vmap.put("sp_yw",1);
		    taskService.complete(task.getId(),vmap);

		    //再次提交.由于task id 不存在了。这里抛出找不到object异常
		    taskService.complete(task.getId(),vmap);

		    //查看历史
		    ActivitiUtils.printProcInstHistory(historicDataService,runtimeService,piId);
	}

}
